<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" href="resource/css/bootstrap.css">
    <script type="text/javascript" src="resource/js/jquery-3.2.1.js"></script>
</head>
<body>
    <form action="list" method="post">
        <input type="hidden" name="pageNum">
        <table class="table">
            <tr>
                <td colspan="22">
                    联络单号:<input type="text" name="danHao" value="${vo.danHao}">
                    类型:<select name="types1">
                            <option value="">===请选择===</option>
                            <option value="1" ${vo.types1==1?'selected':''}>制造部编号</option>
                            <option value="2" ${vo.types1==2?'selected':''}>制造部</option>
                            <option value="3" ${vo.types1==3?'selected':''}>配件编号</option>
                            <option value="4" ${vo.types1==4?'selected':''}>配件名称</option>
                        </select>
                    内容:<input type="text" name="neiRong" value="${vo.neiRong}">
                    备注:<input type="text" name="beiZhu" value="${vo.beiZhu}">
                    报送日期:<input type="date" name="days1" value="<fmt:formatDate value="${vo.days1}" pattern="yyyy-MM-dd"></fmt:formatDate>">至
                            <input type="date" name="days2" value="<fmt:formatDate value="${vo.days2}" pattern="yyyy-MM-dd"></fmt:formatDate>">
                    <input type="submit" value="查询">

                </td>
            </tr>

            <tr>
                <td>报送日期</td>
                <td>联络单号</td>
                <td>制造部编号</td>
                <td>制造部</td>
                <td>配件编号</td>
                <td>配件名称</td>
                <td>金额</td>
                <td>加工检验</td>
                <td>采购人</td>
                <td>报销人</td>
                <td>备注</td>
                <td>
                    操作
                    <a href="toAdd">添加</a>
                </td>
            </tr>
            <c:forEach var="wei" items="${info.list}">
                <tr>
                    <td><fmt:formatDate value="${wei.days}" pattern="yyyy-MM-dd"></fmt:formatDate></td>
                    <td>${wei.danHao}</td>
                    <td>${wei.bianHao}</td>
                    <td>${wei.zhiZao}</td>
                    <td>${wei.peiJian.id}</td>
                    <td>${wei.peiJian.name}</td>
                    <td>${wei.money}</td>
                    <td>${wei.imgs}</td>
                    <td>${wei.cPerson}</td>
                    <td>${wei.bPerson}</td>
                    <td>${wei.beiZhu}</td>
                    <td>
                        <a href="toUpate?id=${wei.danHao}">修改</a>
                        <input type="button" value="删除" onclick="del('${wei.danHao}')">
                    </td>
                </tr>
            </c:forEach>
            <tr>
                <td colspan="22">
                    <jsp:include page="/resource/page/pages.jsp"></jsp:include>
                    <%--<button name="pageNum" value="1">首页</button>
                    <button name="pageNum" value="${info.prePage==0?1:info.prePage}">上一页</button>
                    <button name="pageNum" value="${info.nextPage==0?info.pages:info.nextPage}">下一页</button>
                    <button name="pageNum" value="${info.pages}">尾页</button>--%>
                </td>
            </tr>
        </table>
    </form>

    <script type="text/javascript">
        function goPage(pageNum){
            $("[name='pageNum']").val(pageNum);
            $("form").submit();
        }

        //删除
        function del(id){
            if (confirm("你确定要删除吗?")){
                $.post(
                    "del",
                    {id:id},
                    function (msg){
                        if (msg>0){
                            alert("删除成功");
                            location="list";
                        }
                    }
                )
            }
        }
    </script>
</body>
</html>
